package com.yuanfeng.payment.handle;

import com.yuanfeng.commoms.util.ResponseResult;
import com.yuanfeng.payment.service.PayStrategyHandleService;
import io.seata.core.exception.TransactionException;
import org.springframework.beans.factory.annotation.Autowired;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.Map;

/**
 * @PROJECT_NAME: PayStrategyHandleContext
 * @DESCRIPTION: 策略类, 指定走具体哪一个策略
 * @USER: hyq
 * @DATE: 2023/1/14 23:12
 */

public class PayStrategyHandleContext {

    @Autowired
    private PayStrategyHandleService payStrategyHandleService;

    public void setPayStrategyHandleService(PayStrategyHandleService payStrategyHandleService) {
        this.payStrategyHandleService = payStrategyHandleService;
    }

    public ResponseResult getMethod(Map<Object, Object> param, HttpServletRequest request, HttpServletResponse response) throws TransactionException {

        ResponseResult result = payStrategyHandleService.userPayEntrance(param, request, response);
        return result;
    }
}
